﻿using Microsoft.Extensions.DependencyInjection;
using Sample.Novel.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Autofac;
using Volo.Abp.Data;
using Volo.Abp.Modularity;
using Volo.Abp.Threading;

namespace Sample.Novel.TestBase
{
    [DependsOn(
        typeof(AbpAutofacModule),
        typeof(AbpTestBaseModule),
        typeof(NovelDomainModule)
        )]
    public class NovelTestBaseModule
        :AbpModule
    {
        //测试使用数据播种
        public override void OnApplicationInitialization(ApplicationInitializationContext context)
        {
            AsyncHelper.RunSync(async () => {
                using var scope = context.ServiceProvider.CreateScope();
                await scope.ServiceProvider
                .GetRequiredService<IDataSeeder>().SeedAsync();
            });
        }
    }
}
